import { HurtType, AttackType, BuffType, TriggerType } from "core/typeDefine/typeDefine"
import { EffectModel, FighterModel } from "./fighterModel"
import { FighterSkillModel } from "./skillModel"




export class DamageDataModel {
    attackType?: AttackType //0正常,1技能
    hurtType: HurtType
    attackHurtCoe: number
    hurtPer: number
    hurtDec: number //伤害递减
    hurtInc: number //伤害提升
    skillIndex: number
    skillID?: number
    skillLvl?: number
    skill: FighterSkillModel

    isDodge: boolean
    isBlock: boolean //是否格挡
    isCrit: boolean
    attackTarget?: FighterModel
    decHpName: string
    addHpName: string
    damage: number
    delayDecHpAnimation: number
    bossHurtPer: number
    seckill: boolean //秒杀
    breakShieldPer: number //击碎护盾
    hpHurtPer: number //血量伤害百分比
    attackerHpHurtPer: number //攻击者血量伤害百分比
    negativeHurtPer: number //负面状态伤害百分比
    maxNegativeHurtPer: number//负面状态总伤害上限
    angerValue: number //技能使用的怒气值
    constructor(opts: any = {}) {
        this.attackType = opts.attackType || AttackType.Normal
        this.attackHurtCoe = opts.attackHurtCoe || 100
        this.hurtPer = opts.hurtPer || 100
        this.hurtDec = opts.hurtDec || 0
        this.hurtInc = opts.hurtInc || 0
        this.skillID = opts.skillID || 0
        this.skillLvl = opts.skillLvl || 1
        this.hurtType = opts.hurtType || HurtType.Physics
        this.isDodge = opts.isDodge || false
        this.isCrit = opts.isCrit || false
        this.attackTarget = opts.attackTarget || null
        this.decHpName = opts.decHpName || ''
        this.addHpName = opts.addHpName || ''
        this.damage = opts.damage || 0
        this.delayDecHpAnimation = opts.delayDecHpAnimation || 0
        this.skill = opts.skill || null
        this.skillIndex = opts.skillIndex == null ? -1 : opts.skillIndex
        this.bossHurtPer = opts.bossHurtPer || 0
        this.seckill = opts.seckill || false
        this.breakShieldPer = opts.breakShieldPer || 0
        this.isBlock = opts.isBlock || false
        this.hpHurtPer = opts.hpHurtPer || 0
        this.attackerHpHurtPer = opts.attackerHpHurtPer || 0
        this.negativeHurtPer = opts.negativeHurtPer || 0
        this.angerValue = opts.angerValue || 0
    }
}

export class TriggerEffectDataModel {
    type: TriggerType
    trigger: FighterModel
    effect: EffectModel
    effectData: any
    skillID: number
    skill?: FighterSkillModel
    attackType?: AttackType
    hurtType?: HurtType
    damage?: number
    isBlock?: boolean //是否格挡
    isCrit?: boolean     //是否暴击
    isDodge?: boolean    //是否闪避
    cureValue?: number
    cureAttriName?: string
    angerValue?: number
    buffType?: BuffType
    constructor(opts: any = {}) {
        this.type = opts.type || 0
        this.trigger = opts.trigger || 0
        this.effect = opts.effect || null
        this.effectData = opts.effectData || null
        this.attackType = opts.attackType || AttackType.Normal
        this.hurtType = opts.hurtType || HurtType.Physics
        this.damage = opts.damage || 0
        this.skillID = opts.skillID || 0
        this.skill = opts.skill || null
        this.isCrit = opts.isCrit || false
        this.isDodge = opts.isDodge || false
        this.cureValue = opts.cureValue || 0
        this.cureAttriName = opts.cureAttriName || ''
        this.angerValue = opts.angerValue || 0
        this.buffType = opts.buffType || BuffType.None
        this.isBlock = opts.isBlock || false
    }
}



export class BattleInfoModel {
    team1: FighterModel[]
    team2: FighterModel[]
    teamIndexID: number
    round: number
    constructor(opts: any = {}) {
        this.team1 = opts.team1 || []
        this.team2 = opts.team2 || []
        this.round = opts.round || 0
        this.teamIndexID = opts.TeamIndexID || 0
    }
}

export class FighterTeamInfoModel {
    team: FighterModel[]
    // frontTeam: FighterModel[]
    altar: FighterModel
    battleSpeed: number[]
    constructor(opts: any = {}) {
        this.team = opts.team || []
        // this.frontTeam = opts.frontTeam || (opts.team || [])
        this.altar = opts.altar || null
        this.battleSpeed = opts.battleSpeed || [0, 1, 2, 3, 4, 5]
    }
}


